import { Component,
    ViewChildren,
    ngAfterViewInit,
    QueryList } from '@angular/core';


@Component({
    selector: 'child-cmp',
    template: '<p>child</p>'
})
class ChildCmp {
    doSomething() { }
}

@Component({
    selector: 'my-app',
    template: `
    <child-cmp #child1></child-cmp>
    <child-cmp #child2></child-cmp>
    <child-cmp #child3></child-cmp>
  `,
    directives: [ChildCmp]
})

export class AppComponent {
    @ViewChildren('child1,child2,child3') children: QueryList<ChildCmp>;
    ngAfterViewInit() {
        // children are set
        this.children.toArray().forEach((child) => child.doSomething());
    }
}
